package com.net.xpay.admin.controller.admin;

import com.net.common.model.ResultPagedList;
import com.net.xpay.common.domain.partner.PartnerSettleRecord;
import com.net.xpay.common.manager.partner.PartnerSettleRecordManager;
import com.net.xpay.common.model.search.PartnerSettleRecordSearchModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 *

 * 合伙人每日统计记录
 */
@RestController
@RequestMapping("/admin/partner-settle-record")
@Api(tags = "运营/合伙人每日统计记录", description = "运营 合伙人每日统计记录 net")
public class AdminSettleRecordController {

    @Autowired
    private PartnerSettleRecordManager partnerSettleRecordManager;

    @ApiOperation("搜索每日统计")
    @PostMapping("/search")
    @ResponseBody
    @PreAuthorize("hasAnyRole('ADMIN', 'partner-settle-record::search')")
    public ResultPagedList<PartnerSettleRecord> searchPartnerSettleRecord(@RequestBody PartnerSettleRecordSearchModel searchModel) {
        List<PartnerSettleRecord> records = partnerSettleRecordManager.search(searchModel);
        long count = partnerSettleRecordManager.searchCount(searchModel);
        return new ResultPagedList<>(records, count, searchModel);
    }
}
